import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [

    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: () =>
            import("../views/Login")
    },
    {
        path: '/rent',
        component: () =>
            import("../views/Rent")
    },
    {
        path: '/rent/add',
        component: () => import("../views/RentAdd")
    },
    {
        path: '/rent/search',
        component: () => import("../views/Search")
    },
    {
        path: '/details/:id',
        component: () =>
            import("../views/Details")
    },
    {
        path: '/citylist',
        component: () =>
            import("../views/CityList")
    },
    {
        path: '/map',
        component: () =>
            import("../views/Map")
    },
    {
        path: '/personal',
        component: () =>
            import("../views/Personal")
    },
    {
        path: '/home',
        component: () =>
            import("../views/Home"),
        children: [{
                path: '/home',
                redirect: '/home/homes',
            },
            {
                path: '/home/homes',
                component: () =>
                    import("../views/Homes"),
            },
            {
                path: '/home/list',
                component: () =>
                    import("../views/List")
            },
            {
                path: '/home/profile',
                component: () =>
                    import("../views/Profile")
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router